package com.smart.community.region.dto;

import lombok.Data;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * 分区保存请求DTO
 *
 * @author Wu.Liang
 * @since 2025-01-30
 */
@Data
public class ZoneSaveRequest {

    /**
     * 社区ID
     */
    @NotNull(message = "社区ID不能为空")
    private Long communityId;

    /**
     * 物业公司ID
     */
    @NotNull(message = "物业公司ID不能为空")
    private Long propertyCompanyId;

    /**
     * 分区数据列表
     */
    private List<ZoneData> zones;

    /**
     * 楼栋位置数据
     */
    private List<BuildingPositionData> buildings;

    /**
     * 绘图数据
     */
    private ZoneDrawingData drawingData;

    /**
     * 操作类型：CREATE-创建，UPDATE-更新
     */
    @NotNull(message = "操作类型不能为空")
    private String operationType;

    /**
     * 分区数据
     */
    @Data
    public static class ZoneData {
        private Long id;
        private String name;
        private String color;
        private List<Point> points;
        private List<Long> buildings;
    }

    /**
     * 楼栋位置数据
     */
    @Data
    public static class BuildingPositionData {
        private Long id;
        private Long zoneId;
        private Double positionX;
        private Double positionY;
    }

    /**
     * 绘图数据
     */
    @Data
    public static class ZoneDrawingData {
        private Long id;
        private Long communityId;
        private String drawingData;
        private List<BuildingPositionData> buildings;
        private List<ZoneData> zones;
        private Integer version;
        private Boolean isCurrent;
    }

    /**
     * 坐标点
     */
    @Data
    public static class Point {
        private Double x;
        private Double y;
    }
}
